package com.hr.leetcode.贪心算法;

import java.util.Arrays;

/**
 * @author 周恒哲
 * @date 2020/05/25
 **/
public class _455_分发饼干 {
    public int findContentChildren(int[] g, int[] s) {
        if (g == null || s == null) {
            return 0;
        }
        Arrays.sort(g);
        Arrays.sort(s);
        int gi=0;//胃口值 gi
        int sj=0;//尺寸 sj
        while (gi<g.length&&sj<s.length){
            if (g[gi]<=s[sj]){
                gi++;
            }
            sj++;
        }
        return gi;
    }
}
